const mysql = require('mysql')
module.exports = {
	//数据库配置
	config:{
		host: '47.240.118.62',
		port: '3306',
		user: 'root',
		password: 'liukai123',
		database: 'gcw'
	},
	//连接数据库
	sqlConnect:function(sql,sqlArr,callBack){
		var pool = mysql.createPool(this.config)
		pool.getConnection((err,conn)=>{
			console.log('123456')
			if(err){
				console.log('连接失败');
				return
			}
			//事件驱动回调
			conn.query(sql,sqlArr,callBack);
			//释放连接
			conn.release();
		})
	}
	
}